﻿#include "SetRateModeDialog.h"

#include <qregexp.h>
#include <qvalidator.h>
#include <qmessagebox.h>

#include "LineEdit_TurnTableRate.h"

SetRateModeDialog::SetRateModeDialog(QWidget* parent) :QDialog(parent)
{
  ui.setupUi(this);
  connect(ui.pushButton_confirm, &QPushButton::clicked, this, &SetRateModeDialog::accept);
  connect(ui.pushButton_cancel, &QPushButton::clicked, this, &SetRateModeDialog::reject);
  ui.lineEdit_rate->turnMode(LineEdit_TurnTableRate::RateMode);
}

SetRateModeDialog::~SetRateModeDialog()
{
}

int SetRateModeDialog::exec()
{
  return QDialog::exec();
}

void SetRateModeDialog::accept()//确认
{
  QDialog::accept();
}

float SetRateModeDialog::getRate()
{
  return ui.lineEdit_rate->getRate();
}
float SetRateModeDialog::getAcceleration()
{
  return ui.lineEdit_acceleration->getAcceleration();
}

int SetRateModeDialog::getAccuracy()
{
  return ui.lineEdit_rate->getAccuracy();
}
void SetRateModeDialog::setAccuracy(int accuracy)
{
  ui.lineEdit_rate->setAccuracy(accuracy);
  ui.lineEdit_acceleration->setAccuracy(accuracy);
}

float SetRateModeDialog::getTurnTableRateUpperLimit()
{
  return ui.lineEdit_rate->getTurnTableRateUpperLimit();
}
void SetRateModeDialog::setTurnTableRateUpperLimit(float turnTableRateUpperLimit)
{
  ui.lineEdit_rate->setTurnTableRateUpperLimit(turnTableRateUpperLimit);
}
float SetRateModeDialog::getTurnTableRateLowerLimit()
{
  return ui.lineEdit_rate->getTurnTableRateLowerLimit();
}
void SetRateModeDialog::setTurnTableRateLowerLimit(float turnTableRateLowerLimit)
{
  ui.lineEdit_rate->setTurnTableRateLowerLimit(turnTableRateLowerLimit);
}
float SetRateModeDialog::getTurnTableAccelerationUpperLimit()
{
  return ui.lineEdit_acceleration->getTurnTableAccelerationUpperLimit();
}
void SetRateModeDialog::setTurnTableAccelerationUpperLimit(float  turnTableAccelerationUpperLimit)
{
  ui.lineEdit_acceleration->setTurnTableAccelerationUpperLimit(turnTableAccelerationUpperLimit);
}
float SetRateModeDialog::getTurnTableAccelerationLowerLimit()
{
  return ui.lineEdit_acceleration->getTurnTableAccelerationLowerLimit();
}
void SetRateModeDialog::setTurnTableAccelerationLowerLimit(float turnTableAccelerationLowerLimit)
{
  ui.lineEdit_acceleration->setTurnTableAccelerationLowerLimit(turnTableAccelerationLowerLimit);
}
